package com.newtouch.xcd.cms.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.newtouch.xcd.cms.config.ProductMarks;
import com.newtouch.xcd.config.entity.ProductMark;
import com.newtouch.xcd.cms.service.ProductMarkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Service
public class ProductMarkServiceImpl implements ProductMarkService {

    @Autowired
    ProductMarks productMarks;

    @Override
    public List<ProductMark> allConfig() {
        return this.productMarks.getConfigs();
    }

    @Override
    public ProductMark queryByProductId(String productId) {

        for(ProductMark config:productMarks.getConfigs()){
            if(productId.equals(config.getProductId())){
                return config;
            }
        }

        return null;
    }
}
